<?php
/**
 * 招生片区管理类
 * @author 肖小平
 *
 */
class EnrollmentAreaAction extends BaseAction{
	//招生片区列表
    public function enrollment_area_list(){
    	$area_arr = M('EnrollmentArea')->select();//查询数据库获取数据，返回array
    	$this->assign('area_arr',$area_arr);
		$this->display();//输出模板
    }
    //添加招生片区
    public function enrollment_area_add(){
    	if($_POST){
    		M('EnrollmentArea')->add($_POST);
    		$this->success('添加成功','enrollment_area_list');
    		exit;
    	}
    	$this->display();//输出模板
    }
    //修改招生片区
    public function enrollment_area_update(){
    	if($_POST){
    		M('EnrollmentArea')->save($_POST);//修改数据库数据
    		$this->success('修改成功','enrollment_area_list');
    		exit;
    	}
    	$obj = M('EnrollmentArea')->where('id = ' .$_GET['id'])->find();//查询id对应的数据，返回array
    	$this->assign('obj',$obj);
    	$this->display();//输出模板
    }
    //删除片区
    public function enrollment_area_delete(){
    	M('EnrollmentArea')->where('id = '.$_GET['id'])->delete();//传入ID删除对应数据
    	$this->success('删除成功','enrollment_area_list');
    }
}